home *** CD-ROM | disk | FTP | other *** search
/ BMUG Revelations / BMUG Revelations.toast / Programming / Programming Languages / Yerk 3.64 / Module source / Print < prev    next >
Text File  |  1990-12-22  |  2KB  |  99 lines

  1. \ print -- Printer support
  2. \ 10/10/84  rw  Version 1
  3. \ 11/22/84  cbd Added vectors for system printing
  4. \ 12/19/84  ssg Moved selectors; added formfeed;
  5. \                Added echovec stuff to +print, -print.
  6. \ 12/31/84  ssg Converted to module.
  7. \  2/13/85  cbd subclass of PBDrvr instead of File
  8. \ 12/19/85  cdn Renamed ff to np (new page), to avoid conflict with $ ff
  9. \  6/27/86  cdn Improved error message for Reset failure
  10. Decimal
  11.  
  12. :Module printMod
  13.  
  14. // drvr
  15.  
  16. SCON PRNAME ".Print"
  17.  
  18. :CLASS PrintFcb  <Super PBDrvr
  19.  
  20.     \ ( -- )
  21.     :M  PINIT:
  22.         prname name: self
  23.         -3 put: IORefNum
  24.     ;M
  25.  
  26.     \ ( -- )
  27.     :M  RESET:
  28.         7    put: csCode
  29.         0    put: IOBuffer
  30.         1    put: csp1     0 put:  csp2
  31.         addr: header fcall PBControl
  32.         abort" Reset Failed; Printer Driver may be missing from disk "
  33.     ;M
  34.  
  35.     :M  FF:
  36.         7    put: csCode
  37.         0    put: IOBuffer
  38.         2    put: csp1  0 put: csp2
  39.         addr: header fcall PBControl
  40.         abort" FF failed "
  41.     ;M
  42.  
  43.     :M  LF:
  44.         7    put: csCode
  45.         0    put: IOBuffer
  46.         3    put: csp1  0 put: csp2
  47.         addr: header fcall PBControl
  48.         abort" LF failed "
  49.         ;M
  50.  
  51.     \ ( -- )
  52.     :M  OPEN:
  53.         pinit: self   open: super  reset: self
  54.         abort" Can't open printer"
  55.     ;M
  56.  
  57.     \ ( addr len -- )
  58.     :M  PRINT:
  59.         5 put: csCode
  60.           put:  IOBuffer
  61.         +base addr: header 28 +  !
  62.         addr: header fcall PBControl
  63.         abort" Print Failed "
  64.     ;M
  65.  
  66.     \ ( char -- )
  67.     :M  PEMIT:
  68.         pad c! pad 1 print: self
  69.     ;M
  70.  
  71.     \ ( -- )
  72.     :M  CLOSE:
  73.         ff: self close: super
  74.         abort" Can't close printer "
  75.     ;M
  76.  
  77. ;CLASS
  78.  
  79. printFcb Printer
  80.  
  81. : pinit  open: printer  ;
  82. : pemit  pemit: printer ;
  83. : ptype  print: printer ;
  84. : pcr    lf:    printer $ 0a ( ASCII linefeed ) pemit ;
  85. \ previously named "ff"; changed to avoid collision with hex # ff
  86. : np     ff: printer ;
  87.  
  88. \ ( c -- )  echo to printer AND screen.
  89. : echo  dup  emitvec pemitvec ;
  90.  
  91. \ enable simultaneous printing of Yerk screen text
  92. : +print
  93.     open: printer  'c pemit -> pemitvec  'c echo -> echovec
  94.     'c ptype -> ptypevec  'c pcr -> pcrvec ;
  95.  
  96. : -print  0 -> pemitvec 0 -> echovec  0 -> ptypevec  0 -> pcrvec ;
  97.  
  98. ;Module
  99.